#pragma GCC optimize(2)
#include <bits/stdc++.h>

using namespace std;
#define int long long
const int inf = 0x3f3f3f3f3f3f3f3f;
const int Mod = 998244353;

int dx[8] = { 1,1,2,2,-1,-1,-2,-2 };
int dy[8] = { 2,-2,1,-1,2,-2,1,-1 };

int qpow(int a, int b)
{
    int ret = 1;
    while (b > 0)
    {
        if (b & 1)
            ret = ret * a % Mod;
        a = a * a % Mod;
        b >>= 1;
    }
    return ret;
}

void solve()
{
    int n;
    cin >> n;
    map<pair<int, int>, int> mp;
    set<pair<int, int>> se;
    for (int i = 0; i < n; i++)
    {
        int x, y;
        cin >> x >> y;
        se.insert({ x,y });
    }
    for (auto it = se.begin(); it != se.end(); it++)
    {
        int x = it->first, y = it->second;
        for (int a = 0; a < 8; a++)
        {
            int xx = x + dx[a], yy = y + dy[a];
            if (xx > 0 && yy > 0 && !se.count({ xx,yy })) mp[{xx, yy}]++;
        }
    }
    pair<int, int> ans = mp.begin()->first;
    int cnt = mp.begin()->second;
    for (auto it = mp.begin(); it != mp.end(); it++)
    {
        if (it->second > cnt)
        {
            ans = it->first;
            cnt = it->second;
        }
    }
    cout << ans.first << ' ' << ans.second << endl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _ = 1;
    //cin >> _;
    while (_--)
    {
        solve();
    }
    return 0;
}